$(function (){
    login.app.btn_1();
    login.app.btn_2();
});

var login = {};

login.app = {};

login.app.btn_1 = function (){
    var reg = /^1[0-9]{10}$/;

    $('.div_3 .btn_z').on('touchstart', function (){
        var val = $('.div_1 .tel').val();
        console.log(val);
        var pass = $('.div_2 .pass_1').val();
        console.log(pass);
        if(reg.test(val)){
        	
        	var token = $("meta[name='_csrf']").attr("content");
       	  	var header = $("meta[name='_csrf_header']").attr("content");
       	 $(document).ajaxSend(function(e, xhr, options) {
       	    xhr.setRequestHeader(header, token);
       	  });
       	 
            $.ajax({
                url:"/user/verifycode",
                type:'POST',
                data:{
                    'phone':val,
                    'password':pass
                },
                dataType:'json',
                success:function (d){

                },
                error:function (d){

                }
            });
        }
    });
};
login.app.btn_2 = function (){
    $('.div_3 .btn_w').on('touchstart', function () {
        window.location.href = 'https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx934ed76c816d2c63&redirect_uri=https%3A%2F%2Fwww.github.com%2Fhzzou&response_type=code&scope=snsapi_userinfo&state=123#wechat_redirect';
        /*window.location.href = 'https://open.weixin.qq.com/connect/qrconnect?appid=wx934ed76c816d2c63&redirect_uri=https%3A%2F%2Fwww.github.com%2Fhzzou&response_type=code&scope=snsapi_userinfo&state=123#wechat_redirect';*/

    });
};